<?php
/**
 * WB_DbObjStore class
 * 
 * SCHEMA:
 * 
 * @author Jean-Lou Dupont
 * @version @@package-version@@
 * @id $Id: DbObjStore.php 74 2008-03-05 01:00:30Z jldupont $
 */
 //{{include
 require_once 'web-bloks/ObjStore/ObjStore.php';
 //include}}
 
 abstract class WB_DbObjStore 
 	extends WB_ObjStore
 {
 	/**
 	 * Constructor
 	 */
	public function __construct( $params )
	{
		parent::__construct( $params );
	}
	
	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%		
	// Interface
	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%		
 	/**
 	 * Verifies if the database schema of the current
 	 * DSN is OK.
 	 * 
 	 * @return string Status Message, empty is everything OK.
 	 */
	abstract public function checkSchema( $schema = null );

	// ======================================================
	// Validators
	// ======================================================
 	/**
 	 * Verifies the $params passed during object 
 	 * instance creation.
 	 *  - table name
 	 *  -
 	 *  
 	 * @throw $class_Exception
 	 */
	protected function validateParams()
	{
		$tableName = $this->params[ 'table' ];
		
		if (empty( $tableName ))
			$this->throwException( 'table name can not be empty' );
		
		if (strpos( '"', $tableName ) !== false )	
			$this->throwException( 'table name can not contain double-quote character' );		

		if (strpos( "'", $tableName ) !== false )	
			$this->throwException( 'table name can not contain single-quote character' );		
	}
 } // end class declaration